/**************************************************************************
 *
 *      Copyright (c) 2005-2008 by Sunplus mMedia Technology Co., Ltd.
 *
 *  This software is copyrighted by and is the property of Sunplus mMedia
 *  Technology Co., Ltd. All rights are reserved by Sunplus mMedia Technology
 *  Co., Ltd. This software may only be used in accordance with the
 *  corresponding license agreement. Any unauthorized use, duplication,
 *  distribution, or disclosure of this software is expressly forbidden.
 *
 *  This Copyright notice MUST not be removed or modified without prior
 *  written consent of Sunplus mMedia Technology Co., Ltd.
 *
 *  Sunplus mMedia Technology Co., Ltd. reserves the right to modify this
 *  software without notice.
 *
 *  Sunplus mMedia Technology Co., Ltd.
 *  19, Innovation First Road, Science-Based Industrial Park,
 *  Hsin-Chu, Taiwan.
 *
 *
 **************************************************************************/

/**
 * @file		sysMemInit.h
 * @brief		system memory initio definition
 * @author		Phil Lin
 * @since		2009-01-06
 * @date		2008-01-06
 */
#ifndef __SYS_MEM_INIT_H__
#define __SYS_MEM_INIT_H__
 //=============================================================================
//Header file
//=============================================================================


//=============================================================================
//Symbol
//=============================================================================
//-----------------------------------------------------------------------------
//Constant
//-----------------------------------------------------------------------------
#define DEV_MEM_SIZE_16M     0x00100000UL
#define DEV_MEM_SIZE_64M     0x00400000UL
#define DEV_MEM_SIZE_128M    0x00800000UL
#define DEV_MEM_SIZE_256M    0x01000000UL
#define DEV_MEM_SIZE_512M    0x02000000UL
//-----------------------------------------------------------------------------
//Type definition
//-----------------------------------------------------------------------------

typedef enum memCbIdx_e {

	/* common area memory block */
	MEM_IDX_COMMON_START = 0, /* Always be 0 */
	MEM_IDX_TEXT = MEM_IDX_COMMON_START, 
	MEM_IDX_DATA,
	MEM_IDX_BP,
	MEM_IDX_OSD_DISP,
	MEM_IDX_OSD_HIDDEN,
	MEM_IDX_CHAR_FONT,
	MEM_IDX_GRAF_FONT,
	MEM_IDX_DOS_WORK,
	MEM_IDX_DOS_FAT1,
	MEM_IDX_DCF_DIR,
	MEM_IDX_FDB,
	MEM_IDX_FILE_ORDER_TAB,
	MEM_IDX_KEY_SOUND,
	MEM_IDX_PWR_CTRL_PARAM,
	MEM_IDX_DOS_RAM,
	MEM_IDX_DPS,
#ifdef ICAT_OPTION	
	MEM_IDX_ICAT_CDSP_PARAM,
	MEM_IDX_ICAT_GAMMA,
	MEM_IDX_ICAT_LC,
#endif
	MEM_IDX_COMMON_END,

	/* still view mode */
	MEM_IDX_STILL_VIEW_START,
	MEM_IDX_STILL_VIEW_AWB_WIN = MEM_IDX_STILL_VIEW_START,
	MEM_IDX_STILL_VIEW_AE_WIN,
	MEM_IDX_STILL_VIEW_PV_A,
	MEM_IDX_STILL_VIEW_PV_B,
	MEM_IDX_STILL_VIEW_PV_C,
	MEM_IDX_STILL_VIEW_PV_D,
#ifdef ICAT_OPTION	
	MEM_IDX_ICAT_TEST,
#endif
	MEM_IDX_STILL_VIEW_END,

	/* video view mode */
	MEM_IDX_VIDEO_VIEW_START,
	MEM_IDX_VIDEO_VIEW_AWB_WIN = MEM_IDX_VIDEO_VIEW_START,
	MEM_IDX_VIDEO_VIEW_AE_WIN,
	MEM_IDX_VIDEO_VIEW_PV_A,
	MEM_IDX_VIDEO_VIEW_PV_B,
	MEM_IDX_VIDEO_VIEW_PV_C,
	MEM_IDX_VIDEO_VIEW_PV_D,
	MEM_IDX_VIDEO_VIEW_END,

	/* video record mode */
	MEM_IDX_VIDEO_REC_START,
	MEM_IDX_VIDEO_REC_VLC_A = MEM_IDX_VIDEO_REC_START,
	MEM_IDX_VIDEO_REC_VLC_B,
	MEM_IDX_VIDEO_REC_VLC_C,
	MEM_IDX_VIDEO_REC_VLC_D,
	MEM_IDX_VIDEO_REC_VLC_E,
	MEM_IDX_VIDEO_REC_VLC_F,
	MEM_IDX_VIDEO_REC_VLC_G,
	MEM_IDX_VIDEO_REC_VLC_H,
	MEM_IDX_VIDEO_REC_VLC_I,
	MEM_IDX_VIDEO_REC_VLC_J,
	MEM_IDX_VIDEO_REC_VLC_TMP,
    MEM_IDX_VIDEO_REC_QTAB,
	MEM_IDX_VIDEO_REC_AUDIO,
	MEM_IDX_VIDEO_REC_FRAG,
	MEM_IDX_VIDEO_REC_HDR,
	MEM_IDX_VIDEO_REC_IDX,
	MEM_IDX_VIDEO_REC_END,

	/* still playback mode */
	MEM_IDX_STILL_PB_START,
	MEM_IDX_STILL_PB_DISP = MEM_IDX_STILL_PB_START,
	MEM_IDX_STILL_PB_GEN_A,
	MEM_IDX_STILL_PB_GEN_B,
	MEM_IDX_STILL_PB_END,

	/* video playback mode */
	MEM_IDX_VIDEO_PB_START,
	MEM_IDX_VIDEO_PB_GEN_A = MEM_IDX_VIDEO_PB_START,
	MEM_IDX_VIDEO_PB_GEN_B,
	MEM_IDX_VIDEO_PB_GEN_C,
	MEM_IDX_VIDEO_PB_FRAG,
	MEM_IDX_VIDEO_PB_VIDEO,
	MEM_IDX_VIDEO_PB_AUDIO,
	MEM_IDX_VIDEO_PB_AUDIO_CHUNK,
	MEM_IDX_VIDEO_PB_IDX,
	MEM_IDX_VIDEO_PB_END,

	/* the whole memory block */
	MEM_IDX_GLOBAL,
	
	MEM_IDX_MAX,
} memCbIdx_t;

typedef struct memCb_s {
	UINT32 addr;
	UINT32 size;
} memCb_t;

//-----------------------------------------------------------------------------
//Variable
//-----------------------------------------------------------------------------
extern const UINT32 xdata devMemSize;
//-----------------------------------------------------------------------------
//Function declare
//-----------------------------------------------------------------------------
void sysMemSizeInit(void);
void sysMemAddrUpdate(void);

void sysMemSizeSet(memCbIdx_t idx, UINT32 size);
UINT32 sysMemAddrGet(memCbIdx_t idx);
UINT32 sysMemAddrGet_Intr(memCbIdx_t idx);
UINT32 sysMemSizeGet(memCbIdx_t idx);
UINT32 sysMemSizeGet_Intr(memCbIdx_t idx);
UINT32 sysMemTotSizeGet(void);

#endif /*__SYS_MEM_INIT_H__*/

